/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.route.system.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author neco
 */
@Entity
@Table(name = "rps_direction_type", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RpsDirectionType.findAll", query = "SELECT r FROM RpsDirectionType r"),
    @NamedQuery(name = "RpsDirectionType.findByTypeId", query = "SELECT r FROM RpsDirectionType r WHERE r.typeId = :typeId"),
    @NamedQuery(name = "RpsDirectionType.findByTypeName", query = "SELECT r FROM RpsDirectionType r WHERE r.typeName = :typeName")})
public class RpsDirectionType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "type_id", nullable = false)
    private Integer typeId;
    @Size(max = 100)
    @Column(name = "type_name", length = 100)
    private String typeName;
    @OneToMany(mappedBy = "descriptionDirectionType")
    private List<RpsRouteDescription> rpsRouteDescriptionList;

    public RpsDirectionType() {
    }

    public RpsDirectionType(Integer typeId) {
        this.typeId = typeId;
    }

    public Integer getTypeId() {
        return typeId;
    }

    public void setTypeId(Integer typeId) {
        this.typeId = typeId;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    @XmlTransient
    public List<RpsRouteDescription> getRpsRouteDescriptionList() {
        return rpsRouteDescriptionList;
    }

    public void setRpsRouteDescriptionList(List<RpsRouteDescription> rpsRouteDescriptionList) {
        this.rpsRouteDescriptionList = rpsRouteDescriptionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (typeId != null ? typeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RpsDirectionType)) {
            return false;
        }
        RpsDirectionType other = (RpsDirectionType) object;
        if ((this.typeId == null && other.typeId != null) || (this.typeId != null && !this.typeId.equals(other.typeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.route.system.entity.RpsDirectionType[ typeId=" + typeId + " ]";
    }
    
}
